<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateScanLoginTable extends Migration
{
    /**
     * Run the migrations.
     * 扫码登录uid记录
     *
     * @return void
     */
    public function up()
    {
        //扫码登录接口
        Schema::create('scan_login', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('employee')->unsigned()->comment('登录者id号')->nullable();
            $table->foreign('employee')->references('id')->on('employees')->onDelete('set null');
            $table->string('uid')->comment('扫码登录的uid')->unique();
            $table->boolean('is_used')->comment('是否已经使用过了')->default(false);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('scan_login');
    }
}
